home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wonky Flux Batch 2019 02
/
Wonky_Flux_Batch_2019-02.zip
/
Wonky Flux Batch 2019-02
/
071 - EXFER 4.1 4.2.dsk
/
EXFER.SEG.S
< prev
next >
Wrap
Text File
|
2019-02-17
|
39KB
|
1,057 lines
; ****************************
;
; EXfer:
; The Extended Transfer Module
;
; This program is for use on
; the ProDOS version of GBBS
; "Pro" 1.2 or "Pro" 1.3.
;
; Written by: Mike Golaszewski
; (C)1986, All Rights Reserved
;
; ****************************
; THIS IS NOT FREEWARE
; user segment, version 4.1
; created 08/22/86 - modified 12/22/87
; A very warm "thank you" goes to the following people: Jerry Cline, for all
; of his suggestions and for providing me with a development system while out
; in Phoenix; Steve Playford, for giving EXfer a new home and taking some
; tremendous pressure off of my back; Keith Christian for his contributions,
; input, and all the laughs. Of course, thanks to Greg Schaefer too.
; define linkable labels
public prompt
public send.2
public terminate
; store existing variables
enter
on nocar goto terminate
print \"XT: Loading EXfer, please hold..."
store "a:variables":gosub store:clear
gosub recall:screen$=chr$(13,2)+chr$(12):xt$=chr$(13)+"XT: "
byte=ram2:v=0:f$="a2:sys.questions":gosub chkfil
close:if not(a) then v=13
f$="a1:xt.users":gosub chkfil:close:if a create f$
open #1,f$:position #1,4,un:read #1,ram2,4:close
xm=byte(0):cr=byte(2)+byte(3)*256:if not(byte(1)) then cr=250
if xm>7 pt=1:xm=xm-8
b$=right$(lc$,3)+left$(lc$,5):lc$=b$
when$=ram2+16:ed=edit(5):if not(v) goto begin
byte=ram+37:dl=byte(3)+nibble(3)*256
ul=byte(4)+nibble(4)*256:byte=ram2
; check for bit map file
begin
f$="a1:xt.bitmap":gosub chkfil:close
if (not(a)) goto begin.1:else fill ed+1,255,255
create f$:open #1,f$:write #1,ed+1,255:close
f$="a1:xt.volumes":kill f$:create f$
; get XMODEM type
begin.1
print screen$" ====================================="
print "= EXfer: The Extended Transfer Module ="
print '= Version 4.1.1 ='
print "= The Professional BBS ="
print " ====================================="
if not(info(2)) input @2 \"Press [RETURN]..." i$:xm=3:pt=0:goto start
if byte(1) goto start
print xt$ ;:input @2 'Does your terminal program support
Ymodem "batch" transfers ? ' i$:i$=left$(i$,1)
if i$="Y" then pt=1:xm=1:print '
XT: You also need to specify the type
of XMODEM your program supports.'
print xt$'Please enter the type of Xmodem you
are using...
[1] DOS 3.3 Xmodem (AE "Pro" DOS)
[2] ProDOS Xmodem (Point to Point, AE)
[3] A standard form of Xmodem
[4] No Xmodem drivers, ASCII only'\
input @2 "XT: Which ? " i$:if i$="" goto exit.1
a=val(i$):if (a<1) or (a>4) goto begin
if a=1 then xm=2:else if a=2 then xm=1
if a=3 then xm=0:else if a=4 then xm=3
byte(0)=xm+(pt*8):byte(1)=1:byte(2)=cr mod 256:byte(3)=cr/256
open #1,"a1:xt.users":position #1,4,un:write #1,ram2,4:close
; try to access default library
start
bb=c:gosub log:if bf$="" goto start.2
if not(b2) gosub lsec:goto exit.1
; got it, enter EXfer
start.1
gosub getslt:gosub volume:goto prompt
; library does not exist
start.2
if not(info(5)) print xt$;chr$(7)"Can't find default library...":goto exit.1
tone(30,30):print xt$"Source library does not exist..."
input @2 " Create ? " i$:if i$<>"Y" goto exit.1:else goto create
; get a command
prompt
on nocar goto terminate
x=(clock(2)-clock(1))/60:x$=right$("0"+str$(x),2)
if x=0 then x$="--":else if (info(5)) or (clock(1)=0) then x$="::"
free:clear key:print \"["x$"] ([?]: Help) ->";
if zz=1 then zz=0:goto command
if zz=3 goto command:else get i$:print chr$(8)" ";chr$(8);
; check for normal command
command
push prompt
if (i$="B") and (pt=1) goto batch
if i$="C" goto aux
if i$="D" goto directory
if i$="F" goto search
if i$="G" goto global
if i$="H" goto aux
if i$="I" goto info
if (i$="J") or (i$="L") goto volume
if i$="K" goto aux
if i$="M" goto aux
if i$="N" goto new
if i$="Z" goto new
if i$="R" goto receive
if i$="S" goto send
if i$="T" goto hangup
if i$="V" goto aux
if i$="W" goto aux
if i$="X" or i$="Q" goto exit
if i$="Y" then c=bb:pt=0:byte(1)=0:pop:goto begin.1
if (i$="?") or (i$="/") goto menu
; check for librarian command
if not(lb) goto prompt.1
if i$="+" and (info(5)) then pt=1:return
if i$="A" and (info(5)) pop:link "a:exfer.sys","add"
if i$="E" and (info(5)) pop:link "a:exfer.sys","external"
if (i$="$") or (i$="-") pop:link "a:exfer.sys","credit"
if i$="O" pop:link "a:exfer.sys","sort"
if i$="P" pop:ob=bb:goto create
if (i$="*") and (info(5)) input @2 "ProDOS: " i$:if i$ setint(1):use "a:xdos",i$:setint("")
if (i$="#") and (info(5)) goto aux
if (i$="2") and (info(5)) pop:link "a:exfer.aux.2"
; not a command
prompt.1
print " "chr$(8);:return
; link to the auxilliary command segment
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
aux
pop:link "a:exfer.aux"
; display a menu
; ~~~~~~~~~~~~~~
menu
print screen$\\s$:l=key(1)
f$="a1:mnu.exfer":if edit(3)=79 then f$=f$+"80"
menu.1
open #1,f$:input #1,x$:setint(" ")
for l=1 to len(x$):addint(mid$(x$,l,1))
next:copy #1
a=key(0)
if a=32 goto menu.cancel
if key(3) goto menu.key
if ((lb) and (f$<>"a1:mnu.sysop")) goto menu.sys
menu.cancel
close:setint(""):return
menu.key
close:setint(""):i$=chr$(a)
zz=1:print:return
menu.sys
close:setint(""):f$="a1:mnu.sysop":goto menu.1
; send a file
; ~~~~~~~~~~~
; get name & verify it
send
if not(b3) goto lsec:else if zz=3 then zz=0:goto xsend
if pt input @2 "Use Ymodem to download batch files ? " i$:i$=left$(i$,1)
if i$="Y" print:goto batch:else zz=3:i$="S":return
xsend
input @2 "Send: " i$:if i$="" return
if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto send.x
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) goto nfile
send.x
if (l<0) goto nfile
if not(byte(9)) goto unval
na$=f$:gosub name:f$=bf$+f$:gosub chkfil
if a close:goto nfile
; compute time of transfer
close:x=((byte(10)+byte(11)*256)/2)*dm
if (not(lb)) and (x>cr) print '
XT: You don'"'"'t have enough credits to
download this file.':return
if xm=3 goto send.1:else bs=byte(10)+byte(11)*256
gosub sendtime:print xt$'Estimated time of transfer is 'a'
minutes, 'c' seconds.':if clock(2)=0 goto send.1
if x<a print xt$;chr$(7)'You do not have enough time left to
download this file.':return
send.1
if xm=3 print xt$"Press [RETURN] to begin...";:get i$:print
if xm<>3 print xt$"Sending "bs" blocks..."
use "a:x.dn",xm,f$:for x=1 to 500:next
; update the record
send.2
on nocar goto terminate
d=0:if not(v) then byte=ram+29:byte(2)=byte(2)+1:byte=ram2:d=1
if v=13 then dl=dl+(peek(ed+3)=255):d=(peek(ed+3)=255)
byte(18)=byte(18)+1:nb=l
if d and (not(lb)) then x=((byte(10)+byte(11)*256)/2)*dm:if dm print '
XT: 'x' credits deducted.':cr=cr-x
push getslt:goto write
; send batch files
; ~~~~~~~~~~~~~~~~
batch
if not(b3) goto lsec:else print "Send batch files..."
print '
XT: Please enter your file list now. A blank entry will exit the selection
mode.'\:y=1:flag=ram2+21:fill ram2+20,44,0:pt=2:bs=0:d=cr
; get a file name or number
batch.1
print "Enter batch file #"right$("00"+str$(y),3);
input @2 ": " i$:if i$="" goto batch.2
if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto batch.x
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) print chr$(8,24)"FILE DOESN'T EXIST"chr$(7):goto batch.1
; make sure file is there and validated
batch.x
if l<0 print chr$(8,24)"FILE DOESN'T EXIST"chr$(7):goto batch.1
if not(byte(9)) print chr$(8,24)"FILE MUST BE VALIDATED"chr$(7):goto batch.1
if ty$="LST" print chr$(8,24)"ADDING LIST FILES"chr$(7):goto lbatch
if lb gosub batch.d:goto batch.1
; check price & see if user has enough credits
z=((byte(10)+byte(11)*256)/2)*dm
if z>d print chr$(8,24)"INSUFFICIENT CREDITS"chr$(7):goto batch
d=d-z:gosub batch.d:goto batch.1
; ::::::::::::::::::::::::::::::::
; we have a file macro, process it
; ::::::::::::::::::::::::::::::::
lbatch
gosub name:f$=bf$+f$:open #2,f$
; fake an input to the user
lbatch.1
input #2,i$:if i$="" close:goto batch.1
if left$(i$,1)=";" goto lbatch.1
print "Enter batch file #"right$("00"+str$(y),3)": "i$
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) print chr$(8,24)"FILE DOESN'T EXIST"chr$(7):goto lbatch.1
; process what we have
if not(byte(9)) print chr$(8,24)"FILE MUST BE VALIDATED"chr$(7):goto lbatch.1
if lb gosub batch.d:goto lbatch.1
; check the price & see if user has enough credits
z=((byte(10)+byte(11)*256)/2)*dm
if z>d print chr$(8,24)"INSUFFICIENT CREDITS"chr$(7):goto lbatch.1
d=d-z:gosub batch.d:goto lbatch.1
; ::::::::::::::::::::::::::::::::
; ready to send files using Ymodem
; ::::::::::::::::::::::::::::::::
; do an "estimated time of transfer" calculation
batch.2
y=y-1:if y=0 then flag=ram+22:pt=1:return
print \"XT: Send "y;:input @0 " files [Y/N] ? " i$
if i$<>"Y" then flag=ram+22:pt=1:return
bs=bs+y/4:gosub sendtime:print '
XT: Estimated time of transfer is 'a' minutes, 'c' seconds.'
if (clock(2)=0) or (x>a) goto batch.3:else print '
XT: 'chr$(7)'You do not have enough time left to download these files.'
flag=ram+22:pt=1:return
; search for a file that has been marked
batch.3
bs=(bs-y/8):poke ram2+20,y:print xt$'Sending 'y' files...'
for l=2 to 255:if flag(l) goto batch.4:else next:goto batch.5
; found a marked file, get its ProDOS filename
batch.4
open #1,d1$:position #1,32,l
input #1,i$:input #1,ty$:read #1,ram2+9,10
close:na$=i$:gosub name:f$=bf$+f$
; send the file using Ymodem
use "a1:y.dn",f$:byte(18)=byte(18)+1
if not(v) then byte=ram+29:byte(2)=byte(2)+1:byte=ram2
if v=13 then dl=dl+1
; update the "number of times downloaded" counter & search for more files
open #1,d1$:position #1,32,l:print #1,na$
print #1,ty$:write #1,ram2+9,10:close:next
; inform remote of EOT, deduct credits, reset FLAG pointer
batch.5
use "a1:y.dn":flag=ram+22:pt=1
if dm and (not(lb)) print xt$;cr-d;" credits deducted.":cr=d:d=0
return
; SUBROUTINE - display & add block size, increment file counter
batch.d
z=((byte(10)+byte(11)*256)-1)*4
print chr$(8,24);i$" ["right$("000"+str$(z),4)"]"
if flag(l+1)=0 then y=y+1:bs=bs+(byte(10)+byte(11)*256)-(byte(10)>0)
flag(l+1)=1:return
; show file info
; ~~~~~~~~~~~~~~
; get filename & look for info
info
d=0:input @2 "Info on: " i$:if i$="" return:else na$=i$
if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto info.x
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) goto nfile
; see if the file has information
info.x
if l<0 goto nfile:else c=byte(12)+byte(13)*256:d=byte(14)
if (not(byte(9))) and (not(lb)) goto unval
if (not(d)) and (lb or (c=un)) goto info.a
if not(d) print xt$;chr$(7)"File has no information":return
; display file information
info.1
i=0
if not(info(2)) input @2 "Do you want a printout? (y/N) "i$:if i$="Y" i=5
input #msg(d),z:input #6,i$:gosub name:print \s$\
setint(1):print #i,"Filename: ";:if lb print #i,bf$;f$:else print #i,i$
copy #6,#i:setint(""):if lb or (c=un) goto info.a
return
; see if info is to be added or updated
info.a
if d print xt$"Edit this information ? ";:else print '
XT: Would you like to enter a short
description of this upload ? ';
input @2 i$:i$=left$(i$,1):if i$<>"Y" return
edit(0):if d input #msg(d),a:input #6,x$\y$\z$\i$:copy #6,#8
gosub edesc:if not(edit(2)) return:else if d goto info.e
a=1:gosub findinfo
; replace information
info.s
open #1,d1$:position #1,32,l+1:input #1,na$:close
kill #msg(d):print #msg(d),un:print #6,na$
print #6,"Uploader: "a1$" "a2$" [#"un"]"
print #6,"Uploaded: "date$" "time$\:copy #8,#6
; update the message file & rewrite directory entry
info.b
msg(d)=255:update:open #1,d1$:position #1,32,l+1
input #1,na$:input #1,ty$:read #1,ram2+9,10:byte(14)=d
position #1,32,l+1:print #1,na$:print #1,ty$
write #1,ram2+9,10:close:return
; info already exists
info.e
input #msg(d),a:input #6,x$\y$\z$:kill #msg(d)
print #msg(d),a:print #6,x$\y$\z$\:copy #8,#6:goto info.b
; SUBROUTINE - find an empty message entry
findinfo
if msg(a) then a=a+1:else d=a:return
if a>msg(0) then d=a:return
goto findinfo
; receive a file
; ~~~~~~~~~~~~~~
; get filename & check for conflicts
receive
if not(b4) goto lsec:else if nb=255 goto dfull
if zz=3 then zz=0:goto recvx
if pt=1 input @2 "Use Ymodem to upload batch files ? " i$:i$=left$(i$,1)
if i$="Y" goto rbch:else zz=3:i$="R":return
recvx
d=0:input @2 "Receive: " i$:if i$="" return
na$=left$(i$+chr$(32,14),15):i$=na$:gosub read
gosub name:f$=bf$+f$:gosub chkfil:close
if a and not(l) goto rec.2
if lb goto rec.1:else print '
XT: 'chr$(7)"Duplicate name on ProDOS volume":return
; see what sysop wishes to do with duplicate
rec.1
if l then nb=l
input @0 \"XT: File exists...overwrite ? " i$
if i$<>"Y" return:else kill f$:d=byte(14)
; if it's a DDD file, switch to standard XMODEM
rec.2
x$=left$(i$+chr$(32,14),15):x=xm:if x=4 goto rec.a
print xt$"Is this a compressed Dalton's Disk
input @2 " Disintegrator file [Y/N/Q] ? " i$
if i$="Q" return
if i$="Y" then dd=1:xm=0
; get the file
rec.a
create f$:print xt$"Ready to receive..."
y=clock(2):a=clock(1):clock(2)=0:use "a:x.up",xm,f$:xm=x:clock(2)=y
c=clock(1):clock(2)=y+(c-a)
if not(v) then nibble(3)=nibble(3)+1:else ul=ul+(peek(ed+3)=255)
if (v=13) and (peek(ed+3)<>255) print '
XT: The file you uploaded was received in
error and has been automatically
deleted...':kill f$:return
; compute some file info
gosub dtype:gosub size:if not(lb) then cr=cr+(a/2)*um
if um and (not(lb)) print xt$"You got "(a/2)*um" credits for this file"
gosub sfile:byte(14)=0:if dd=1 then dd=0:x=254:gosub type:ty$="DDD"
; ask for a description
on nocar goto rec.4
if d print xt$'Do you want to change the existing
file information ? ';:else print xt$'Would you like to enter a short
description of this upload ? ';
input @2 i$:i$=left$(i$,1):if i$<>"Y" goto rec.3
if d input #msg(d),a:input #6,x$\y$\z$:copy #6,#8
edit(0):gosub edesc:if not(edit(2)) goto rec.3
if d then byte(14)=d:kill #msg(d):update:goto rec.i
a=1:gosub findinfo
rec.i
kill #msg(d):print #msg(d),un:print #6,na$
print #6,"Uploader: "a1$" "a2$" [#"un"]"
print #6,"Uploaded: "date$" "time$\:copy #8,#6
msg(d)=255:update
rec.3
if d then byte(14)=d
if not(v) print xt$'If there is a problem with this
upload, use the [K] command to
delete it...'
push getslt:if nb<>byte(4) goto write:else goto update
; loss of carrier - save file and then hang up
rec.4
if d then byte(12)=d
push terminate:if nb<>byte(4) goto write:else goto update
; receive files using Ymodem batch
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rbch
i$="":if lb input @2 '
XT: Overwrite existing files ? ' i$:if i$="" return
i$=left$(i$,1):if i$="Y" then a=255:else a=0:print '
XT: Files being uploaded may be renamed if there is a duplicate file name on
the host ProDOS volume.'
x=0:d=0:print xt$"Receiving batch; begin sending files now..."
; receive a file
rbch.1
i$=chr$(32,15):use "a1:y.up",bf$,a,b,i$:if i$=chr$(32,15) goto rbch.2
na$=i$:i$=left$(i$+chr$(32,14),15):gosub read:f$=bf$+na$:na$=i$
create "a2:ul.log":open #1,"a2:ul.log":append #1
print #1,a1$" "a2$" Y-loaded "f$" into library "bb\"on "date$" "time$\
close #1
if b kill f$:tone(110,75):tone(190,75):goto rbch.1
tone(190,75):tone(110,75):p=0:if l then p=byte(14):nb=l
b=x:gosub dtype:x=b:b=a:gosub size:if um and (not(lb)) then d=d+(a/2)*um
byte(14)=p:gosub sfile:a=b:byte(14)=p:x=x+1
if nb<>byte(4) gosub write:else gosub update
gosub getslt:goto rbch.1
rbch.2
print xt$ ;x;" files received successfuly":if um and (not(lb)) print '
XT: You received 'd' credits for your batch upload':cr=cr+d
d=0:return
; new file search
; ~~~~~~~~~~~~~~~
new
print screen$"XT: ";
if i$="N" print "Display new files...":else print "Scan files by date..."
if i$="N" then c=1:goto new.1
print xt$"Default date is "mid$(lc$,4,5);left$(lc$,3)
print xt$"Enter new date or press [RETURN] to"
input @2 " accept default: " i$:if i$="" then i$=lc$:goto new.1
if (mid$(i$,3,1)<>"/") or (mid$(i$,6,1)<>"/") print '
XT: Please use the form: MM/DD/YY...';:get i$:print:i$="Q":goto new
c=3:i$=right$(i$,3)+left$(i$,5)
new.1
print:gosub scanvol:gosub security:x=b:print \s$:goto scanit
; search for a file
; ~~~~~~~~~~~~~~~~~
search
b=0:input @2 "Find: " i$:if i$="" return
print:gosub scanvol:print screen$"XT: Searching for..."\" :>"i$\\s$
gosub security:c=2:x=b:goto scanit
; global file list
; ~~~~~~~~~~~~~~~~
global
print screen$'XT: Global directory of all accessable
downloads...'\:gosub scanvol
c=4:gosub security:x=b:print \s$:goto scanit
; :::::::::::::::::::::::::::::::::::::::::::
; subroutines for various "file scan" options
; :::::::::::::::::::::::::::::::::::::::::::
; get a starting library number
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scanvol
input @2 \"XT: Starting at library #" x$:b=0:if x$="" then b=1
if not(b) then b=val(x$):if (b<1) or (b>255) print '
XT: 'chr$(7)"That library doesn't exist.":pop:return
f$="a1:xv."+str$(b):gosub chkfil:close:if not(a) return
print xt$ ;chr$(7)"Starting library doesn't exist.":pop:return
; search for and display a particular file entry
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scanit
b=1:ob=bb:for z=x to 255:setint(1):flag=ram2+32:y=flag(z):flag=ram+22
if key(1) then z=255:next:goto scanit.3
if y goto scanit.1:else next:goto scanit.3
; log to the library and show we are examining it
scanit.1
bb=z:gosub log:if b print xt$"Scanning library #"right$("00"+str$(bb),3);
if not(b) print chr$(8,3);right$("00"+str$(bb),3);
if bf$="" then l=z:gosub biterr:next:goto scanit.3
if not(b2) next:goto scanit.3
b=0:open #1,d1$:for l=1 to byte(4):position #1,l+1,32
input #1,f$:if f$="" goto scanit.2
input #1,ty$:read #1,ram2+9,10:b$=when$
a$=right$(b$,3)+left$(b$,5):setint(1)
; do necessary checks for whatever scan function we are using
if (c=1) and (lc$<=a$ or not(byte(9))) goto scanit.d
if (c=2) and (instr(i$,f$)) goto scanit.d
if (c=3) and (i$<=a$) goto scanit.d
if (c=4) goto scanit.d
goto scanit.2
; display the file entry on the screen
scanit.d
b=b+1:if b=1 print chr$(8,25);:gosub dir.h
gosub dir.e:print
; we are finished, or interrupted
scanit.2
if key(1) then l=byte(4):z=255
next:close:setint(""):next
scanit.3
print:bb=ob:goto log
; log to a different library
; ~~~~~~~~~~~~~~~~~~~~~~~~~~
; get new volume & see if it exists
volume
print "Go to a different library..."\xt$"Current library is #"bb
input @2 " Go to library [?]..." i$:if i$="" return
if i$="?" goto vol.2:else a=val(i$):if (a<1) or (a>255) print '
XT: 'chr$(7)"That library doesn't exist":return
; try to log to library
ob=bb:bb=a:gosub log:if bf$="" then l=bb:gosub biterr:goto vol.1
if not(b2) gosub lsec:bb=ob:goto log
print xt$"Please hold...":gosub getslt
goto directory
; find out if this library is to be created
vol.1
if not(info(5)) print '
XT: 'chr$(7)"That library doesn't exist...":bb=ob:goto log
tone(20,20):input @0 \"XT: Library doesn't exist...create ? " i$
if i$<>"Y" then bb=ob:goto log:else goto create
; scan bit map for available libraries
vol.2
print screen$"XT: You may access the following..."\\s$\
open #1,"a1:xt.bitmap":read #1,ed+1,255:close
open #1,"a1:xt.volumes":for l=1 to 255
setint(1): x=peek(ed+l):if key(1) then l=255:next:goto vol.4
if x>34 next:goto vol.4
if not(x) goto vol.3:else if flag(x) goto vol.3
next:goto vol.4
vol.3
position #1,32,l:input #1,x$
setint(1):print "["right$("00"+str$(l),3)"]: "x$:if key(1) l=255
next
; finished with list
vol.4
close:setint(""):print:clear key:goto volume
; hang up
; ~~~~~~~
; make sure user wishes to terminate call
hangup
input @2 "Hang up ? " i$:if left$(i$,1)<>"Y" return
poke ram2+32,1:goto byecon
; restore GBBS variables and link to the terminate code
terminate
poke ram2+32,3:goto byecon
; SUBROUTINE - restore variables & do 1.3 conversions if needed
byecon
if cr<0 then cr=0
byte=ram2:byte(0)=xm+(pt*8):byte(1)=1:byte(2)=cr mod 256:byte(3)=cr/256
open #1,"a1:xt.users":position #1,4,un:write #1,ram2,4:close
poke ram2,v:when$=ram+20:if not(v) then byte=ram+29:goto byecon.1
byte=ram+37:nibble(3)=dl/256:byte(3)=dl mod 256
nibble(4)=ul/256:byte(4)=ul mod 256
byecon.1
print '
:::::::::::::::::::::::::::::::::::::
: Exfer ver 4.1.1 Professional BBS :
:::::::::::::::::::::::::::::::::::::'
flag=ram+22:clear:recall "a:variables":kill "a:variables":x=peek(ram2)
if x=13 then ul=byte(4)+nibble(4)*256:dl=byte(3)+nibble(3)*256
if peek(ram2+32)=1 link "a:main.seg","termin2"
if peek(ram2+32)=2 link "a:main.seg","fromsys"
if peek(ram2+32)=3 link "a:main.seg","term1"
; exit back to the board
; ~~~~~~~~~~~~~~~~~~~~~~
; make sure the user wants to exit back to the bulletin board
exit
input @2 "Exit back to the BBS ? " i$:if left$(i$,1)<>"Y" return
; recall variables & add uploads & downloads
exit.1
poke ram2+32,2:goto byecon
; routines to edit or create libraries
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
create
link "a:exfer.sys","create"
; :::::::::::::::::::
; library subroutines
; :::::::::::::::::::
; catalog a library
; ~~~~~~~~~~~~~~~~~
; print directory headers
directory
print screen$:gosub dir.h
if not(b3) print "XT:"chr$(7)" Directory disallowed...":goto getslt
use "a1:xtyp",bf$
; grab an entry
open #1,d1$:for l=1 to byte(4):f$=""
position #1,32,l+1:input #1,f$:input #1,ty$
position #1,32,l+1,20:read #1,ram2+9,10:if f$="" goto dir.1
setint(1)
; if its valid, print it
gosub dir.e:print:if byte(9) goto dir.1
if (not(byte(9))) and (not(lb)) goto dir.1
; update if not validated
print chr$(7,3);"** Validate above file [y/N/k] ? ";:get i$
print chr$(8,35);chr$(32,35);chr$(8,35)
if i$="Y" position #1,32,l+1,20:print #1,chr$(255);
if i$<>"K" goto dir.1:else position #1,32,l+1:fill ram2+9,31,0
print #1,chr$(13):write #1,ram2+9,30:i$=f$:gosub name
kill f$:if l<nb then nb=l
dir.1
if key(1) then l=byte(4)
next:close:setint("")
x=peek(865)+peek(866)*256:y=peek(867)+peek(868)*256
z=x-y:print \"Kbytes Free: "left$(str$(z)+chr$(32,4),5);
print " " ;right$(" Kbytes Used: "+str$(y),19);
if edit(3)>39 print chr$(32,10)"Total Kbytes: "x:else print
return
; :::::::::::::::::::::::::::::::
; "directory display" subroutines
; :::::::::::::::::::::::::::::::
; show a directory header
; ~~~~~~~~~~~~~~~~~~~~~~~
dir.h
print right$("00"+str$(bb),3)": "bn$;
if edit(3)>39 print chr$(32,22)"Librarian:";
print " "right$("00"+str$(b1),3)\\" # Filename Type ";
if edit(3)<79 print "Size Dated Cost"\:return
print "I Size Uploaded Uploader Downloaded Credits Misc"\
return
; show a directory entry
dir.e
print right$("00"+str$(l+1),3)" "f$" "ty$" ";:if edit(3)<79 goto dir.x
if byte(14) print "Y ";:else print "N ";
dir.x
x=byte(10)+byte(11)*256:print right$(" "+str$(x),4)" ";
b$=when$:a$=right$(b$,3)+left$(b$,5):y=byte(18):x=byte(12)+b yte(13)*256
if edit(3)<79 goto dir.40
if not(byte(9)) poke 50,255:print "VALIDATE";:poke 50,0
if (byte(9)) and (lc$>a$) print b$;:goto dir.c
if not(byte(9)) goto dir.c
poke 50,255:print "NEW FILE";:poke 50,0
dir.c
print " User "right$("00"+str$(x),3)" "right$(" "+str$(y),3)" times ";
x=((byte(10)+byte(11)*256)/2)*dm:print right$(" "+str$(x),7)" ";
if lc$<=a$ print "NEW";
return
dir.40
if not(byte(9)) print " VAL ";
if (lc$>a$) and (byte(9)) print left$(b$,5);:else if byte(9) print " NEW ";
x=((byte(10)+byte(11)*256)/2)*dm:if cr>=x print "$";:else print " ";
print right$(" "+str$(x),4);:return
; :::::::::::::
; directory I/O
; :::::::::::::
; log to a library and get some dir info
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log
byte=ram2:fill ram2,32,0:bf$="":z$="a1:xv."+str$(bb)
open #1,z$:input #1,bn$:input #1,bf$
read #1,ram2,9:close:b1=byte(5)+byte(6)*256
b2=1:if byte(0) then b2=flag(byte(0))
b3=1:if byte(1) then b3=flag(byte(1))
b4=1:if byte(2) then b4=flag(byte(2))
um=byte(7):dm=byte(8):lb=(un=b1)
if info(5) then lb=1:b2=1:b3=1:b4=1
d1$="a1:xv."+str$(bb):d2$="a1:dv."+str$(bb)
if bf$ ready d2$:bf$=left$(bf$,instr(":",bf$))
return
; get an empty slot
; ~~~~~~~~~~~~~~~~~
getslt
nb=0:open #1,d1$:for l=1 to byte(4)
position #1,32,l+1:input #1,i$
if (i$="") and (nb=0) then nb=l:l=byte(4)
next:close:if not(nb) then nb=byte(4)
return
; update "number of entries" counter
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update
byte(4)=byte(4)+1:open #1,d1$:print #1,bn$
print #1,bf$:write #1,ram2,9:close
; write a directory entry
; ~~~~~~~~~~~~~~~~~~~~~~~
write
open #1,d1$:position #1,32,nb+1:print #1,na$
print #1,ty$:write #1,ram2+9,10:close
z=nb:return
; read a directory entry
; ~~~~~~~~~~~~~~~~~~~~~~
read
open #1,d1$:for l=1 to byte(4)
position #1,32,l+1:input #1,f$
if instr(i$,f$)=1 then p=l:l=byte(4):next:l=p:goto read.1
next:close #1:l=0:return
read.1
input #1,ty$:read #1,ram2+9,10:close #1
return
; read a file by slot #
; ~~~~~~~~~~~~~~~~~~~~~
nread
if left$(i$,1)="#" then i$=mid$(i$,2)
l=val(i$):if (l<2) or (l>253) then l=0:return
open #1,d1$:position #1,32,l
input #1,f$:if f$="" close #1:l=0:return
input #1,ty$:read #1,ram2+9,10:close #1
i$=f$:if pt=2 return:else print \"XT: [#"l"]: "i$:return
: ::::::::::::::::::::::
; miscellaneous disk I/O
; ::::::::::::::::::::::
; find the type of a file
; ~~~~~~~~~~~~~~~~~~~~~~~
dtype
use "a1:xtyp",f$:x=peek(ram2+32)
x$="???0TXT4PDA5BIN6ADB25AWP26ASP27SRC176OBJ177LIB178S16179R TL180EXE181"
x$=x$+"STR182RIF183NDA184CDA185SET186PNT192PIC193ANI194FNT20 0PAS239CMD240"
x$=x$+"COM245P16249BAS252VAR253REL254SYS255"
ty$="":y=instr(str$(x),x$):if y then ty$=mid$(x$,y-3,3):goto id
ty$="$"+chr$(48+x/16+((x/16)>9)*7)+chr$(48+x mod 16+((x mod 16)>9)*7)
; detect Macbinary or Binary ][ formats
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
id
x$=right$(f$,4)
if (x$=".BNY") or (x$=".BQY") or (x$=".SQZ") then ty$=right$(x$,3):return
open #1,f$:read #1,ram2+32,3:close #1
if (byte(32)=10) and (byte(33)=71) and (byte(34)=76) then ty$="BNY"
if (ty$="???") and ((byte(32)=0) and (byte(33))) then ty$="MAC"
return
; set the type of a file
; ~~~~~~~~~~~~~~~~~~~~~~
type
use "a1:xtyp",f$,x:return
; return the size of F$ in A
; ~~~~~~~~~~~~~~~~~~~~~~~~~~
size
open #1,f$:a=size(1)/2+1:close:return
; see if file exists
; ~~~~~~~~~~~~~~~~~~
chkfil
open #1,f$:a=mark(1):return
; ::::::::::::::::::
; general processing
; ::::::::::::::::::
; setup directory entry in RAM2
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sfile
byte(9)=byte(3):byte(10)=a mod 256:byte(11)=a/256
byte(12)=un mod 256:byte(13)=un/256:byte(18)=0
when$="x":if lb then byte(9)=255
return
; convert to a valid ProDOS name
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; shorten I$ to directory length
name
if len(i$)>15 then i$=left$(i$,15)
i$=i$+chr$(1)
; make sure the first char is a letter
name.0
a=asc(left$(i$,1)):if a=1 pop:return
if (a>64) and (a<91) then i$=left$(i$,len(i$)-1):goto name.1
if (a>96) and (a<123) then i$=left$(i$,len(i$)-1):goto name.1
i$=mid$(i$,2):goto name.0
; remove symbols from the name
name.1
f$="":for x=1 to len(i$):a=asc(mid$(i$,x,1))
if (a>64) and (a<91) goto name.2
if (a>96) and (a<123) goto name.2
if (a>47) and (a<58) goto name.2
if a=46 goto name.2:else goto name.3
; add a valid character
name.2
f$=f$+chr$(a)
; if we dont have a name, return to the prompt
name.3
next:if f$="" pop:return
if len(f$)>15 then f$=left$(f$,15)
return
; move security flags from EDIT(5) to RAM2+32
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
security
open #1,"a1:xt.bitmap":read #1,ed+1,255:close:fill ram2+32,32,0
for l=1 to 255:if peek(ed+l)>34 next:return
x=peek(ed+l):if (flag(x)) or (x=0) then flag=ram2+32:flag(l)=1:flag=ram+22
next:return
; :::::::::::::::::::::::::
; miscellaneous subroutines
; :::::::::::::::::::::::::
; save user's stats before CLEAR
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
store
clear #8:byte=ram2:byte(0)=c:byte(1)=un mod 256
byte(2)=un/256:print #8,a1$,a2$,s$,lc$:return
; recall a user's stats after CLEAR
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
recall
c=byte(0):un=byte(1)+byte(2)*256
input #8,a1$,a2$,s$,lc$:return
; compute an "estimated time of transfer"
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sendtime
x=bs/2:x=x+x/8:bs=bs*4:c=info(2)
if c=1 then b=x*34
if c=4 then b=x*9
if c=8 then b=x*4
a=b/60:c=b mod 60:x=(clock(2)-clock(1))/60
bs=(byte(10)+byte(11)*256-(byte(10)>0))*4
return
; get a file description
; ~~~~~~~~~~~~~~~~~~~~~~
edesc
create "a2:ul.log":open #1,"a2:ul.log":append #1
print #1,a1$" "a2$" uploaded "f$" in library "bb\" on "date$" "time$\
close #1
print '
Enter description: 'edit(3)' cols, [4K] max
[DONE] when finished, [.H] for help'
edit(1):return
; update errant bit-map
; ~~~~~~~~~~~~~~~~~~~~~
biterr
open #1,"a1:xt.bitmap":read #1,ed+1,255:close
poke ed+l,255:open #1,"a1:xt.bitmap"
write #1,ed+1,255:close:open #1,"a1:xt.volumes"
position #1,32,l:print #1,chr$(13):close
return
; ::::::::::::::
; error messages
; ::::::::::::::
lsec
print \xt$ ;chr$(7)" Security too low...":return
dfull
print xt$ ;chr$(7)" Directory full...":return
nfile
print xt$ ;chr$(7)" No such file...":return
unval
print xt$ ;chr$(7)' File must be validated before it
can be accessed...':return